﻿using System;
using System.Collections.Generic;

using System.Text;

namespace TA.Turbo.Controls
{
	/// <summary>
	/// Hidden field control, rendered as INPUT tag with type of HIDDEN.
	/// </summary>
	public class Hidden : BaseFieldControl<string>
	{
		#region INTERNAL
		#region METHODS
		#region INIT
		/// <summary>
		/// Registers InputControl.js.
		/// </summary>
		protected internal override void RegisterIncludes(IncludeCollection includes)
		{
			base.RegisterIncludes(includes);

			includes.Add(new ScriptResourceInclude("TA.Turbo.Res.JS.Simple.InputControl.js", typeof(BaseCommandControl)));
		}
		#endregion
		#region RENDER
		/// <summary>
		/// Adds the type attribute valued "hidden".
		/// </summary>
		/// <param name="writer"></param>
		protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
		{
			writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Type, "hidden");

			base.AddAttributesToRender(writer);
		}
		public override void RenderControl(System.Web.UI.HtmlTextWriter writer)
		{
			if (this.get_IsDesignMode())
			{
				writer.Write("<span>[Hidden " + this.ID + "]</span>");
			}
			else
			{
				base.RenderControl(writer);
			}
		}
		#endregion
		#endregion
		#endregion
	}
}
